<?php

namespace App\Listeners\Train\TrainOrder\Refund;

use App\Events\Train\TrainOrder\Refund\TicketReturnApplyEvent;
use App\Trip\Train\Order\Impl\PiaoChiTicketReturnImpl;
use Exception;

class TicketReturnApplyListener
{
    /**
     * Create the event listener.
     *
     * @return void
     */
    public function __construct()
    {
        //
    }

    /**
     * Handle the event.
     *
     * @param object $event
     *
     * @return void
     * @throws Exception
     */
    public function handle(TicketReturnApplyEvent $event)
    {
        $passenger    = $event->passenger;
        $refund_info  = $event->refund_info;
        $order        = $passenger->getOrderInfo();
        $ticketReturn = new PiaoChiTicketReturnImpl($order, $passenger, $refund_info);
        $ticketReturn->ticket_return();

    }
}
